package com.iwhalecloud.bss.kite.cucc.service.scene.query;


import com.github.pagehelper.PageInfo;
import com.iwhalecloud.bss.kite.client.api.scene.query.IQueryWorkBenchService;
import com.iwhalecloud.bss.kite.client.dto.workbench.BulletinDocRelDTO;
import com.iwhalecloud.bss.kite.client.dto.workbench.BulletinRcvObjRelDTO;
import com.iwhalecloud.bss.kite.client.dto.workbench.SysuserCollectionDTO;
import com.iwhalecloud.bss.kite.service.scene.bo.QueryWorkBenchBO;
import com.ztesoft.bss.common.bo.MenuInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;


@Service("queryWorkBenchService")
public class QueryWorkBenchService implements IQueryWorkBenchService {

    @Autowired
    private QueryWorkBenchBO queryWorkBenchBO;


    /**
     * 公告列表
     *
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public PageInfo<BulletinRcvObjRelDTO> listBulletin(Integer pageIndex, Integer pageSize) {
        PageInfo<BulletinRcvObjRelDTO> bulletinRcvObjRel = queryWorkBenchBO.listBulletin(pageIndex, pageSize);
        return bulletinRcvObjRel;
    }

    /**
     * 读公告
     *
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void makeAsRead(String blletinRcvObjRelId) {
        queryWorkBenchBO.makeAsRead(blletinRcvObjRelId);
    }

    /**
     * 公告列表
     *
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<BulletinDocRelDTO> getBulletinDocRel(String blletinId) {
        return queryWorkBenchBO.getBulletinDocRel(blletinId);
    }

    /**
     * 菜单列表
     *
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<MenuInfo> listMenu() {
        List<MenuInfo> funcMenuDTOList = queryWorkBenchBO.listMenu();
        return funcMenuDTOList;
    }


    /**
     * 首页常用功能列表，我的关注列表，我的常用链接列表
     *
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<SysuserCollectionDTO> homePageList(String menuTyp) {
        return queryWorkBenchBO.homePageList(menuTyp);
    }


    /**
     * 查询代理商余额
     *
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Map<String, Object> queryBalance() {
        return queryWorkBenchBO.queryBalance();
    }


}
